<!DOCTYPE HTML>
<html>
<head>
	<title>{$data.name}</title>
	<meta charset="utf-8">
	<meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1, user-scalable=no">
	<link href="http://static.hongdayun.com/public/bootstrap/3.3.5/bootstrap.min.css" rel="stylesheet">
	<link href="http://static.hongdayun.com/public/bootstrap/3.3.5/bootstrap.theme.min.css" rel="stylesheet">
	<script src="http://static.hongdayun.com/public/jquery/2.1.4/jquery.min.js"></script>
	<script src="http://static.hongdayun.com/public/bootstrap/3.3.5/bootstrap.min.js"></script>
	<script src="http://static.hongdayun.com/public/simplecartjs/3.0.5/simpleCart.min.js"></script>
	
	<script>
		simpleCart.currency({
			code: "RMB" ,
			name: "Chinese Yuan" ,
			symbol: "￥" ,
			delimiter: "" , 
			decimal: "." , 
			after: false ,
			accuracy: 2
		});
		simpleCart({
			cartColumns: [
				{ view:"image",attr: "img" , label: "" } ,
				{ attr: "name" , label: " " } ,
				{ attr: "price" , label: " ", view: 'currency' } ,
				{ view: "decrement" , label: false , text: "-" } ,
				{  view: "input" ,attr: "quantity" , label: " " } ,
				{ view: "increment" , label: false , text: "+" } ,
				{ attr: "total" , label: " ", view: 'currency' } ,
				//{ view: "remove" , text: "取消" , label: false }
			]
		});
		
		simpleCart({
		checkout: { 
			type: "SendForm" , 
			url: "__APP__/Home/Order/Create/Addon/Mall.html" ,

			method: "POST" , 

			} 
		});
		
	</script>
	
</head>
<body>
<nav class="navbar navbar-default">
  <div class="container-fluid">
    <!-- Brand and toggle get grouped for better mobile display -->
    <div class="navbar-header">
      <button type="button" class="navbar-toggle collapsed" data-toggle="collapse" data-target="#bs-example-navbar-collapse-1" aria-expanded="false">
        <span class="sr-only">默认模板</span>
        <span class="icon-bar"></span>
        <span class="icon-bar"></span>
        <span class="icon-bar"></span>
      </button>
      <a class="navbar-brand" href="#">默认模板</a>
    </div>

    <!-- Collect the nav links, forms, and other content for toggling -->
    <div class="collapse navbar-collapse" id="bs-example-navbar-collapse-1">
      <ul class="nav navbar-nav">
        <li class="active"><a href="__APP__/Home/Mall/Index/Addon/MallTemplateDefault.html">首页</a></li>
        <li><a href="__APP__/Home/Mall/Cart/Addon/MallTemplateDefault.html">购物车</a></li>
        <li><a href="javascript:;" class="simpleCart_checkout">提交购物车</a></li>
       
      </ul>
      
      
    </div><!-- /.navbar-collapse -->
  </div><!-- /.container-fluid -->
</nav>
<div class="container-fluid">
	<div class="row">
		<volist name="list" id="list">	
		<div class="col-md-2">
			<div class="panel panel-default">
			  <div class="panel-heading">{$list.name} - ￥{$list.money}元/{$list.unit}</div>
			  <div class="panel-body">
				<img src="{$list.img}" style="width:100%;height:100%;">
			  </div>
			  <div class="panel-footer"><a href="#"  onclick="add_good_for_cart_{$list.id}();" class="btn btn-success" style="width:100%;">加入购物车</a></div>
			</div>
			<script>
				function add_good_for_cart_{$list.id}(){
					
					
					simpleCart.add({name:'{$list.name}', price: {$list.money},goods_id:'{$list.id}',img:'{$list.img}',quantity: 1});
					
						
				}
			</script>
		</div>
		</volist>
	</div>
</div>
	   <script>
	   
	   

			function cart_{$list.id}(){
				
				var is_buy =  {$list.is_buy};
				
				if(is_buy==1){
				
					var myItem = simpleCart.add({name:'{$list.title}', price: {$list.money},img:'{$list.img}',gid:'{$list.id}',quantity: {$list.is_buy},is_buy: {$list.is_buy}});
					myItem.remove();
					simpleCart.add({name:'{$list.title}', price: {$list.money},img:'{$list.img}',gid:'{$list.id}',quantity: {$list.is_buy},is_buy: {$list.is_buy}});
					
					alert('限购{$list.is_buy}{$list.unit}');
					//var s = myItem.get( "gid" );
					//var ss = myItem.id();
					//var sss = myItem.quantity();
					
					
					
					
				}else{
					simpleCart.add({name:'{$list.title}', price: {$list.money},img:'{$list.img}',gid:'{$list.id}',quantity: 1,is_buy: {$list.is_buy}});
				
				}
				
				

				//window.location.href="__APP__/Mall/Goods/Cart.html"; 
			}
			
			
		
		</script>



        
 

</body>
</html>
